package com.ssy.lingxi.settle.accounts.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 业务请款单行核销记录信息DO
 * @author Saske
 * @date 2021/12/7
 * @version 2.0.0
 */
@Entity
@Table(schema = "public",
        name = "sa_apply_amount_row_write_off_record",
        indexes = {@Index(name = "sa_apply_amount_row_write_off_record_apply_row_id_idx",columnList = "apply_row_id"),
                @Index(name = "sa_apply_amount_row_write_off_record_write_off_row_record_id", columnList = "writeOffRowRecordId")
})
public class ApplyAmountRowWriteOffRecordDO implements Serializable {
    private static final long serialVersionUID = -965158378248212624L;

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sa_apply_amount_row_write_off_record_seq")
    @SequenceGenerator(sequenceName = "sa_apply_amount_row_write_off_record_seq", name = "sa_apply_amount_row_write_off_record_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联请款单（物料对账） 明细行 -业务相关
     */
    @JsonBackReference
    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
    @JoinColumn(name = "apply_row_id")
    private ApplyAmountRowDO applyRow;

    /**
     * 请款单（非物料对账）明细行 -业务相关
     */
    @Column
    private Long writeOffRowRecordId;

    /**
     * 核销金额 - 业务相关
     */
    @Column
    private BigDecimal writeOffAmount;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public ApplyAmountRowDO getApplyRow() {
        return applyRow;
    }

    public void setApplyRow(ApplyAmountRowDO applyRow) {
        this.applyRow = applyRow;
    }

    public Long getWriteOffRowRecordId() {
        return writeOffRowRecordId;
    }

    public void setWriteOffRowRecord(Long writeOffRowRecordId) {
        this.writeOffRowRecordId = writeOffRowRecordId;
    }

    public BigDecimal getWriteOffAmount() {
        return writeOffAmount;
    }

    public void setWriteOffAmount(BigDecimal writeOffAmount) {
        this.writeOffAmount = writeOffAmount;
    }
}
